"""
@name : 11.python的自省
@author : wenyao
@projectname: xsfh
"""
# import math
# #python的自省
# hasattr(math, "xx") #判断math有没有xx属性
# getattr(math, "xx") #获取math的xx属性
# setattr(math, "xx", "obj") #设置math的xx属性为obj
# delattr(math, "xx") #删除math的xx属性

class A:
    name = "sc"
    __max = "max"
    def func1(self):
        print("i am func1")
    def func2(self):
        print("i am func2")
a = A()
choose = input("please input function:")
if hasattr(a,choose):
    result = getattr(a,choose)
    result()
else:
    setattr(a,choose,"choose!!!!!!!!!!!")
    print(getattr(a,choose))


